package alp.starcode.nudtportal.framework.mybatis.entity;

import alp.starcode.nudtportal.framework.constant.ElasticConst;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * <p>
 * module_config（模块配置表）
 * </p>
 *
 * @author xwx
 * @since 2023-08-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("module_config")
@ApiModel(value = "ModuleConfig对象", description = "module_config（模块配置表）")
@Document(indexName = ElasticConst.ES_INDEX_MODULE_CONFIG)
public class ModuleConfig extends Model<ModuleConfig> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "模块流水号")
    @TableId("module_id")
    @Field(type = FieldType.Keyword)
    private String moduleId;

    @ApiModelProperty(value = "模块名称")
    @TableField("module_name")
    @Field(type = FieldType.Text, analyzer = ElasticConst.ES_IK_MAX_WORD)
    private String moduleName;

    @ApiModelProperty(value = "模块key")
    @TableField("module_key")
    @Field(type = FieldType.Text)
    private String moduleKey;

    @ApiModelProperty(value = "模块关键字")
    @TableField("module_keywords")
    @Field(type = FieldType.Text, analyzer = ElasticConst.ES_IK_MAX_WORD)
    private String moduleKeywords;

    @ApiModelProperty(value = "模块图标")
    @TableField("icon_path")
    @Field(type = FieldType.Text)
    private String iconPath;

    @ApiModelProperty(value = "重定向地址")
    @TableField("rewrite_url")
    @Field(type = FieldType.Text)
    private String rewriteUrl;

    @ApiModelProperty(value = "访问地址")
    @TableField("access_address")
    @Field(type = FieldType.Text)
    private String accessAddress;

    @ApiModelProperty(value = "小程序appid")
    @TableField("applet_id")
    @Field(type = FieldType.Text)
    private String appletId;

    @ApiModelProperty(value = "是否显示：0显示、1不显示")
    @TableField("is_publish")
    @Field(type = FieldType.Boolean)
    private Boolean isPublish;

    @ApiModelProperty(value = "是否公开:0公开、1不公开")
    @TableField("is_open")
    @Field(type = FieldType.Boolean)
    private Boolean isOpen;

    @ApiModelProperty(value = "访问类型：0H5、1微信小程序、2支付宝小程序、3WEB")
    @TableField("module_type")
    @Field(type = FieldType.Integer)
    private Integer moduleType;

    @ApiModelProperty(value = "模块备注")
    @TableField("module_remarks")
    @Field(type = FieldType.Text, analyzer = ElasticConst.ES_IK_MAX_WORD)
    private String moduleRemarks;

    @ApiModelProperty(value = "是否是个人中心模块 0:不是 1：是")
    @TableField("is_personal_center")
    @Field(type = FieldType.Integer)
    private Integer isPersonalCenter;

    @ApiModelProperty(value = "个人中心排序")
    @TableField("personal_center_order")
    @Field(type = FieldType.Double)
    private Double personalCenterOrder;

    @ApiModelProperty(value = "是否删除：0：未删除，1：已删除")
    @TableField("is_deleted")
    @TableLogic
    private Integer isDeleted;

    @TableField("create_user_id")
    @Field(type = FieldType.Text)
    private String createUserId;

    @TableField("create_time")
    @Field(type = FieldType.Long)
    private Long createTime;

    @TableField("update_user_id")
    @Field(type = FieldType.Text)
    private String updateUserId;

    @TableField("update_time")
    @Field(type = FieldType.Long)
    private Long updateTime;


    @Override
    protected Serializable pkVal() {
        return this.moduleId;
    }

}
